package com.j283_5.wisdom_park.vo.maintenance_management;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.j283_5.wisdom_park.pojo.Maintenance;
import com.j283_5.wisdom_park.pojo.Warning;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author shkstart
 * @create 2022-05-03-21:36
 */
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MaintenanceVo implements Serializable {
    /**
     * 运维记录id
     */
    @TableId(value = "mrec_id", type = IdType.AUTO)
    private Integer mrecId;

    /**
     * 设备名称
     */
    private String ddetName;

    /**
     * 设备编号
     */
    private String ddetNumber;
    /**
     * 安装位置
     */
    private String dinfLocation;
    /**
     * 预警内容
     */
    private String wrecContent;

    /**
     * 0:故障检修,1:日常巡检
     */
    private String mrecMaintenancetype;
    /**
     * 0:未完成,1:巡检中,2:已完成
     */
    private String mrecMaintenancestate;
    /**
     * 巡检时间
     */
    private Timestamp mrecDate;
    /**
     * 设备类型名称
     */
    private String ddetStyle;


    public MaintenanceVo(Maintenance maintenance){
        this.ddetName = maintenance.getDdetName();
        this.ddetNumber = maintenance.getDdetNumber();
        this.ddetStyle = maintenance.getDdetStyle();
        this.dinfLocation = maintenance.getDinfLocation();
        this.mrecId = maintenance.getMrecId();
        this.wrecContent = maintenance.getWrecContent();
        if (maintenance.getMrecDate() != null) {
            this.mrecDate = maintenance.getMrecDate();
        }
        if (maintenance.getMrecMaintenancetype() != null){
            setMrecMaintenancetype(maintenance.getMrecMaintenancetype());
        }
        if (maintenance.getMrecMaintenancestate() != null){
            setMrecMaintenancestate(maintenance.getMrecMaintenancestate());
        }
    }
    public void setMrecMaintenancetype(Integer mrecMaintenancetype){
        switch (mrecMaintenancetype){
            case 0:
                this.mrecMaintenancetype = "故障检修";
                return;
            case 1:
                this.mrecMaintenancetype = "日常巡检";
                return;
            default:
                this.mrecMaintenancetype = "日常巡检";
        }
    }

    public void setMrecMaintenancestate(Integer mrecMaintenancestate){
        switch (mrecMaintenancestate){
            case 0:
                this.mrecMaintenancestate = "未完成";
                return;
            case 1:
                this.mrecMaintenancestate = "巡检中";
                return;
            case 2:
                this.mrecMaintenancestate = "已完成";
                return;
            default:
                this.mrecMaintenancestate = "未完成";
        }
    }

    public Integer getMrecId() {
        return mrecId;
    }

    public void setMrecId(Integer mrecId) {
        this.mrecId = mrecId;
    }

    public String getDdetName() {
        return ddetName;
    }

    public void setDdetName(String ddetName) {
        this.ddetName = ddetName;
    }

    public String getDdetNumber() {
        return ddetNumber;
    }

    public void setDdetNumber(String ddetNumber) {
        this.ddetNumber = ddetNumber;
    }

    public String getDinfLocation() {
        return dinfLocation;
    }

    public void setDinfLocation(String dinfLocation) {
        this.dinfLocation = dinfLocation;
    }

    public String getWrecContent() {
        return wrecContent;
    }

    public void setWrecContent(String wrecContent) {
        this.wrecContent = wrecContent;
    }

    public String getMrecMaintenancetype() {
        return mrecMaintenancetype;
    }

    public void setMrecMaintenancetype(String mrecMaintenancetype) {
        this.mrecMaintenancetype = mrecMaintenancetype;
    }

    public String getMrecMaintenancestate() {
        return mrecMaintenancestate;
    }

    public void setMrecMaintenancestate(String mrecMaintenancestate) {
        this.mrecMaintenancestate = mrecMaintenancestate;
    }

    public Timestamp getMrecDate() {
        return mrecDate;
    }

    public void setMrecDate(Timestamp mrecDate) {
        this.mrecDate = mrecDate;
    }

    public String getDdetStyle() {
        return ddetStyle;
    }

    public void setDdetStyle(String ddetStyle) {
        this.ddetStyle = ddetStyle;
    }
}
